package com.gupao.rpc.protocol.constants;

import jdk.internal.org.objectweb.asm.tree.analysis.Value;

/**
 * 序列化类型
 *
 * @author SuperWein
 */
public enum SerialType {

    /**
     * 请求
     */
    JSON((byte) 1),
    /**
     * 响应
     */
    JAVA((byte) 2);

    /**
     * 序列化类型
     */
    private final byte serialType;

    SerialType(byte serialType) {
        this.serialType = serialType;
    }

    public byte value() {
        return this.serialType;
    }

    public static SerialType getReqType(byte serialType) {
        for (SerialType value : SerialType.values()) {
            if (serialType == value.serialType) {
                return value;
            }
        }
        return SerialType.JSON;
    }

}
